package com.st.buy.portal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author 张双虎
 */
@Controller
public class IndexController {
    @Value("${contentService}")
    private String contentService;
    @Autowired
    private RestTemplate restTemplate;
    @RequestMapping("/")
    public String index(Model model){
        //这里的103应该写在配置文件中。  暂时先写死
        model.addAttribute("ad1List",restTemplate.getForObject("http://"+contentService+"/content/queryByCid/103",List.class) );
        return "index";
    }
}
